summaryrefslogtreecommitdiffstats
path: root/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesPresenter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesPresenter.java')
-rw-r--r--src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesPresenter.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesPresenter.java b/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesPresenter.java
new file mode 100644
index 000000000..9d8040e1b
--- /dev/null
+++ b/src/android/app/src/main/java/org/citra/citra_emu/ui/platform/PlatformGamesPresenter.java
@@ -0,0 +1,42 @@
+package org.citra.citra_emu.ui.platform;
+
+
+import org.citra.citra_emu.CitraApplication;
+import org.citra.citra_emu.model.GameDatabase;
+import org.citra.citra_emu.utils.Log;
+
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public final class PlatformGamesPresenter {
+ private final PlatformGamesView mView;
+
+ public PlatformGamesPresenter(PlatformGamesView view) {
+ mView = view;
+ }
+
+ public void onCreateView() {
+ loadGames();
+ }
+
+ public void refresh() {
+ Log.debug("[PlatformGamesPresenter] : Refreshing...");
+ loadGames();
+ }
+
+ private void loadGames() {
+ Log.debug("[PlatformGamesPresenter] : Loading games...");
+
+ GameDatabase databaseHelper = CitraApplication.databaseHelper;
+
+ databaseHelper.getGames()
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(games ->
+ {
+ Log.debug("[PlatformGamesPresenter] : Load finished, swapping cursor...");
+
+ mView.showGames(games);
+ });
+ }
+}